package com.liang.bishi.tc;

import java.util.HashSet;
import java.util.Scanner;

/**
 * 第二题：
 * 小红准备在一个网站注册账号和密码。
 * 该网站提示：1.用户名需为 6~12个英文字母（大小写均可），2.不能重复注册。
 * 输出每次操作的返回结果。
 * <p>
 * 4
 * abcdef
 * abc
 * abcdef
 * abcd2f
 * <p>
 * registration complete
 * illegal length
 * acount existed
 * illegal charactor
 */
public class Problem2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        HashSet<String> registeredAccounts = new HashSet<>();
        for (int i = 0; i < n; i++) {
            String accounts = in.nextLine();
            System.out.println(getAnswer(accounts, registeredAccounts));
        }
    }

    public static String getAnswer(String accounts,
                                   HashSet<String> registeredAccounts) {
        if (accounts.length() < 6 || accounts.length() > 12) {
            return "illegal length";
        } else if (!accounts.matches("[a-zA-z]+")) {
            return "illegal charactor";
        } else if (registeredAccounts.contains(accounts)) {
            return "acount existed";
        } else {
            registeredAccounts.add(accounts);
            return "registration complete";
        }
    }

}
